package com.kgis.system.access.common.service;

import java.util.List;
import java.util.Map;

import com.irm.system.access.common.support.BatchSaveCallback;
import com.irm.system.authorization.vo.UserContext;
import com.platform.dao.vo.CriteriaParameter;
import com.platform.model.Model;
import common.vo.Ordering;
import common.vo.Pagination;

public interface AbstractNamespaceAccessService<T extends Model> extends AbstractExecutiveAccessService<T> {

	String getNamespace();

	long sequence(UserContext userContext);

	T save(T model, UserContext userContext);

	List<T> save(List<T> models, UserContext userContext);

	void save(List<T> models, BatchSaveCallback<T> saveListCallback, UserContext userContext);

	/** create */
	int create(List<T> models, UserContext userContext);

	/** retrieve/read/find */
	List<T> findByIds(long[] ids, UserContext userContext);

	T findOne(final String statement, CriteriaParameter parameter, UserContext userContext);

	T findOne(final String statement, Map<String, Object> parameter, UserContext userContext);

	T findOne(CriteriaParameter parameter, UserContext userContext);

	T findOne(Map<String, Object> parameter, UserContext userContext);

	List<T> find(final String statement, Map<String, Object> parameter, Ordering ordering, UserContext userContext);

	List<T> find(final String statement, CriteriaParameter parameter, Ordering ordering, UserContext userContext);

	List<T> find(Map<String, Object> parameter, Ordering ordering, UserContext userContext);

	List<T> find(CriteriaParameter parameter, Ordering ordering, UserContext userContext);

	List<T> find(final String statement, Map<String, Object> parameter, UserContext userContext);

	List<T> find(final String statement, CriteriaParameter parameter, UserContext userContext);

	List<T> find(Map<String, Object> parameter, UserContext userContext);

	List<T> find(CriteriaParameter parameter, UserContext userContext);
	
	List<T> find(String statement, Map<String, Object> parameters, int skipResult, int maxResult, Ordering ordering, UserContext userContext);
	
	List<T> find(String statement, CriteriaParameter parameter, int skipResult, int maxResult, Ordering ordering, UserContext userContext);

	List<T> find(Map<String, Object> parameters, int skipResult, int maxResult, Ordering ordering, UserContext userContext);
	
	List<T> find(CriteriaParameter parameter, int skipResult, int maxResult, Ordering ordering, UserContext userContext);
	
	List<T> find(Map<String, Object> parameters, int skipResult, int maxResult, UserContext userContext);
	
	List<T> find(CriteriaParameter parameter, int skipResult, int maxResult, UserContext userContext);
	
	Pagination<T> findPagination(final String statement, Map<String, Object> parameter, Ordering ordering, final Pagination<T> pagination, UserContext userContext);

	Pagination<T> findPagination(final String statement, CriteriaParameter parameter, Ordering ordering, final Pagination<T> pagination, UserContext userContext);

	Pagination<T> findPagination(Map<String, Object> parameter, Ordering ordering, final Pagination<T> pagination, UserContext userContext);
	
	// Added by honghui on 2011/06/29
	Pagination<T> findPagination(Map<String, Object> parameter, Ordering ordering, final Pagination<T> pagination, int skipResult, int maxResult, UserContext userContext);

	Pagination<T> findPagination(CriteriaParameter parameter, Ordering ordering, final Pagination<T> pagination, UserContext userContext);
	
	// Added by honghui on 2011/06/29
	Pagination<T> findPagination(CriteriaParameter parameter, Ordering ordering, final Pagination<T> pagination, int skipResult, int maxResult, UserContext userContext);

	Pagination<T> findPagination(Map<String, Object> parameter, final Pagination<T> pagination, UserContext userContext);
	
	Pagination<T> findPagination(CriteriaParameter parameter, final Pagination<T> pagination, UserContext userContext);
	
	Pagination<T> findPagination(Ordering ordering, Pagination<T> pagination, UserContext userContext);

	Pagination<T> findPagination(Pagination<T> pagination, UserContext userContext);

	Pagination<T> findPagination(UserContext userContext);

	// List<T> findAll(UserContext userContext);

	/** count */
	int count(final String statement, Map<String, Object> parameter, UserContext userContext);

	int count(final String statement, CriteriaParameter parameter, UserContext userContext);

	/** delete */
//	int delete(String statement, T model, UserContext userContext);
	int delete(String statement, Map<String, Object> parameter, UserContext userContext);

	int delete(String statement, CriteriaParameter parameter, UserContext userContext);
}
